package tree;


import tree.data.TreeNode;

/**
 *
 * 翻转二叉树
 *
 * https://leetcode.cn/problems/invert-binary-tree/?envType=study-plan-v2&envId=top-100-liked
 */
public class InvertTree {


    public TreeNode invertTree(TreeNode root) {
        if (root==null){
            return null;
        }

        TreeNode left=invertTree(root.left);
        TreeNode right=invertTree(root.right);


        root.left=right;
        root.right=left;

        return root;
    }
}
